package com.thyme.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.thyme.system.dao.Iec61850DoDao;
import com.thyme.system.service.Iec61850DoService;
import com.thyme.system.vo.Iec61850DoVo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author nana
 * @since 2021-03-24
 */
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class Iec61850DoServiceImpl  implements Iec61850DoService {
    private final Iec61850DoDao iec61850DoDao;
    @Override
    public void updateDo(Iec61850DoVo iec61850DoVo) {
        QueryWrapper<Iec61850DoVo> queryWrapper = new QueryWrapper<Iec61850DoVo>();
        queryWrapper.eq("do_path",iec61850DoVo.getDoPath());
        Iec61850DoVo tmp =  iec61850DoDao.selectOne(queryWrapper);
        if(tmp==null){
            iec61850DoDao.insert(iec61850DoVo);
        }else {
            iec61850DoDao.update(iec61850DoVo,queryWrapper);
        }
    }
}
